import request from './request'

export const list = (data) => {
  return request({
    url: '/user/list',
    method: 'POST',
    data
  })
}

export const save = (data) => {
  return request({
    url: '/user/save',
    method: 'POST',
    data
  })
}

export const modify = (data) => {
  return request({
    url: '/user/modify',
    method: 'POST',
    data
  })
}

export const remove = (data) => {
  return request({
    url: '/user/remove',
    method: 'POST',
    data
  })
}

export const get = (id) => {
  return request({
    url: '/user/get?id=' + id,
    method: 'GET'
  })
}

// 查询角色信息
export const listRole = (data) => {
  return request({
    url: '/user/listRole',
    method: 'POST',
    data
  })
}

// 查询当前用户拥有角色
export const listRoleByAdminId = (data) => {
  return request({
    url: '/user/listRoleByAdminId/' + data,
    method: 'GET',
    data
  })
}

// 给角色添加权限
export const saveRole = (data) => {
  return request({
    url: '/user/saveRole',
    method: 'POST',
    data
  })
}
